package com.catchu.pattern.creational.迭代器模式.e随机翻页迭代器.aggregate;

import com.catchu.pattern.creational.迭代器模式.e随机翻页迭代器.iterator.ArrayIterator;
import com.catchu.pattern.creational.迭代器模式.e随机翻页迭代器.iterator.Iterator;
import com.catchu.pattern.creational.迭代器模式.e随机翻页迭代器.model.PayModel;

/**
 * 数组实现的聚合对象
 */
public class ArrayPayAggregate {

    private PayModel[] pms = null;

    public void calcSalary(){
        PayModel payModel1 = new PayModel();
        payModel1.setName("张三");
        payModel1.setSalary(3000.0);

        PayModel payModel2 = new PayModel();
        payModel2.setName("李四");
        payModel2.setSalary(4000.0);

        PayModel payModel3 = new PayModel();
        payModel3.setName("王五");
        payModel3.setSalary(5000.0);

        PayModel payModel4 = new PayModel();
        payModel4.setName("赵六");
        payModel4.setSalary(6000.0);

        PayModel payModel5 = new PayModel();
        payModel5.setName("孙七");
        payModel5.setSalary(7000.0);

        pms = new PayModel[5];
        pms[0] = payModel1;
        pms[1] = payModel2;
        pms[2] = payModel3;
        pms[3] = payModel4;
        pms[4] = payModel5;
    }

    public PayModel[] getPays(){
        return pms;
    }

}
